<?php
    include('./config.php');
    include('./request.php');
    $goods_id = $result->goods_id;
    $goods_model = $result->goods_model;
    $market_name = $result->market_name;
    $goods_sendState = $result->goods_sendState;
    $goods_name = $result->goods_name;
    $user_name = $result->user_name;
    try{
        $pdo = new PDO($dsn,$user,$pass);
        $pdo->beginTransaction();
        $sql1 = "select user_id,user_name from user where user_name='".$user_name."';";
        $res1 = $pdo->prepare($sql1);
        $res1->execute();
        $rea = $res1->fetch(PDO::FETCH_ASSOC);
    if($rea['user_name']==$user_name){
        $user_id = $rea['user_id'];
        $sql = "update purchaseorder set sendState='已发货' where goods_id=".$goods_id." and goods_name='".$goods_name."' and goods_model='".$goods_model."' and market_name='".$market_name."' and user_id=".$user_id;
        $res = $pdo->prepare($sql);
        $res->execute();
        if($res){
            $pdo->commit();
            echo "ok";
        }else{
            $pdo->rollBack();
            echo "error";
        }
    }else{
        $pdo->rollBack();
        echo "error";
    }
    }catch(PDOException $e){
        $pdo->rollBack();
        echo "服务器出错";
    }
?>